<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>SHOP 管理中心 - 属性管理 </title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="/admin/styles/general.css" rel="stylesheet" type="text/css" />
<link href="/admin/styles/main.css" rel="stylesheet" type="text/css" />
</head>
<body>

<h1>
<span class="action-span">商品属性</span>
<span class="action-span1">SHOP 管理中心 </span><span id="search_id" class="action-span1"> - 添加属性 </span>
<div style="clear:both"></div>
</h1>

<div class="main-div">
  <form action="" method="post" name="theForm">
   <input type="hidden" name="_token" value="<?php echo csrf_token(); ?>">
   <input type="hidden" name="types" value="{{$type}}">
   <input type="hidden" name="attr_id" value="{{$result->attr_id}}">
  <table width="100%" id="general-table">
      <tbody><tr>
        <td class="label">属性名称：</td>
        <td>
          <input type="text" name="attr_name" value="{{$result->attr_name}}" size="30">
      </tr>
      <tr>
        <td class="label">所属商品类型：</td>
        <td>
          <select name="type_id">
          <option value="0">请选择...</option>
          @foreach  ($res as $k=>$v)
            @if($result->type_id == $v->type_id)
            <option value="{{$v->type_id}}" selected>{{$v->type_name}}</option> 
            @else
            <option value="{{$v->type_id}}">{{$v->type_name}}</option> 
            @endif
          @endforeach         
          </select>    
          </td>
      </tr>
      <tr>
        <td class="label">属性是否可选</td>
        <td>
        @if($result->attr_type == 0)
          <input type="radio" name="attr_type" value="0" checked="true"> 唯一属性          
          <input type="radio" name="attr_type" value="1"> 单选属性          
          <input type="radio" name="attr_type" value="2"> 复选属性          <br>
        @elseif($result->attr_type == 1)
          <input type="radio" name="attr_type" value="0"> 唯一属性          
          <input type="radio" name="attr_type" value="1" checked="true"> 单选属性          
          <input type="radio" name="attr_type" value="2"> 复选属性          <br>
        @elseif($result->attr_type == 2)
          <input type="radio" name="attr_type" value="0"> 唯一属性          
          <input type="radio" name="attr_type" value="1"> 单选属性          
          <input type="radio" name="attr_type" value="2" checked="true"> 复选属性          <br>
        @endif
        </td>
      </tr>
      <tr>
        <td class="label">该属性值的录入方式：</td>
        <td>
        @if($result->attr_input_type == 0)
          <input type="radio" name="attr_input_type" value="0" class="attr_input_type" checked="true" >手工录入  
          <input type="radio" name="attr_input_type" value="1" class="attr_input_type">下拉录入
        @else
          <input type="radio" name="attr_input_type" value="0" class="attr_input_type">手工录入  
          <input type="radio" name="attr_input_type" value="1" class="attr_input_type" checked="true">下拉录入
        @endif
          
          </td>
      </tr>
      <tr>
        <td class="label">可选值列表：</td>
        <td>
          <textarea name="attr_value" cols="30" rows="5" class="attr_value">{{$result->attr_value}}</textarea>
        </td>
      </tr>
      <tr>
        <td colspan="2">
        <div class="button-div">
          <input type="submit" value=" 确定 " class="button">
          <input type="reset" value=" 重置 " class="button">
        </div>
        </td>
      </tr>
      </tbody></table>
  </form>
</div>

<div id="footer">
	版权所有 &copy; 2006-2013 软工教育 - 高级PHP - </div>
</div>

</body>
<script src="<?=URL::asset('/admin/js/jquery.1.12.js')?>"></script>
<script>
// $(document).ready(function(){
//   $('.attr_value').attr("disabled",'disabled');
// })
  $('.attr_input_type').on('click',function(){
    var input_type=$(this).val();
    if(input_type == "0"){
      $('.attr_value').attr("disabled",'disabled');
    }else{
      $('.attr_value').removeAttr('disabled');
    }
  })
</script>
</html>